package com.ruoyi.device.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.mapper.SceneManagementMapper;
import com.ruoyi.device.domain.SceneManagement;
import com.ruoyi.device.service.ISceneManagementService;

import static com.ruoyi.common.security.utils.SecurityUtils.getLoginUser;

/**
 * 场景管理Service业务层处理
 * 
 * @author li
 * @date 2025-09-17
 */
@Service
public class SceneManagementServiceImpl implements ISceneManagementService 
{
    @Autowired
    private SceneManagementMapper sceneManagementMapper;

    /**
     * 查询场景管理
     * 
     * @param id 场景管理主键
     * @return 场景管理
     */
    @Override
    public SceneManagement selectSceneManagementById(Long id)
    {
        return sceneManagementMapper.selectSceneManagementById(id);
    }

    /**
     * 查询场景管理列表
     * 
     * @param sceneManagement 场景管理
     * @return 场景管理
     */
    @Override
    public List<SceneManagement> selectSceneManagementList(SceneManagement sceneManagement)
    {
        return sceneManagementMapper.selectSceneManagementList(sceneManagement);
    }

    /**
     * 新增场景管理
     * 
     * @param sceneManagement 场景管理
     * @return 结果
     */
    @Override
    public int insertSceneManagement(SceneManagement sceneManagement)
    {
        sceneManagement.setCreateBy(getLoginUser().getUsername());
        sceneManagement.setCreateTime(DateUtils.getNowDate());
        return sceneManagementMapper.insertSceneManagement(sceneManagement);
    }

    /**
     * 修改场景管理
     * 
     * @param sceneManagement 场景管理
     * @return 结果
     */
    @Override
    public int updateSceneManagement(SceneManagement sceneManagement)
    {
        sceneManagement.setUpdateBy(getLoginUser().getUsername());
        sceneManagement.setUpdateTime(DateUtils.getNowDate());
        return sceneManagementMapper.updateSceneManagement(sceneManagement);
    }

    /**
     * 批量删除场景管理
     * 
     * @param ids 需要删除的场景管理主键
     * @return 结果
     */
    @Override
    public int deleteSceneManagementByIds(Long[] ids)
    {
        return sceneManagementMapper.deleteSceneManagementByIds(ids);
    }

    /**
     * 删除场景管理信息
     * 
     * @param id 场景管理主键
     * @return 结果
     */
    @Override
    public int deleteSceneManagementById(Long id)
    {
        return sceneManagementMapper.deleteSceneManagementById(id);
    }
}
